# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-rule
pkgname=('python-rule' 'python2-rule')
_pkgname=rule
pkgver=0.1.1
pkgrel=5
pkgdesc='A rule engine written in python.'
arch=('any')
url='https://pypi.org/project/rule/'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/r/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('56b97d9a41e2c23b677cb0aa5dc0f98d62a2647dc17d34a183bb81e6206bd0e4a8d93a2000c412feb92625b567f8de6fd13dee69cc53d12ebf274dc09f99f19f')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-rule() {
  depends=('python2' 'python2-six' 'python2-pyaml')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-rule() {
  depends=('python' 'python-six' 'python-pyaml')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

